﻿
//-------字符串截取处理--------
function DoString(pString, pLength, pIsShow) {
    if (pString) {
        if (pString.length < pLength) {
            return pString;
        } else {
            // ReSharper disable once UsingOfReservedWord
            var char = "...";
            if (!pIsShow) {
                char = "";
            }
            return pString.substring(0, pLength) + char;
        }
    }
    return pString;
}


//-------去掉空格----------
function strutil(str) {
    if (str == null) return "";
    str = str.replace(/[\r\n]/g, "");
    str = str.replace(/[ ]/g, "");
    str = str.replace(" ", "");
    return $.trim(str);
};

//------去掉非法字符-------
function strips(s) {
    var pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~！@#￥……&*（）&mdash;—|{}【】‘；：”“'。，、？]")
    var rs = "";
    for (var i = 0; i < s.length; i++) {
        rs = rs + s.substr(i, 1).replace(pattern, '');
    }
    return rs;
};



